#include "TransformFeedbackObject.h"

TransformFeedbackObject::TransformFeedbackObject()
{
	GL( glGenTransformFeedbacks(1, &id); )
}

TransformFeedbackObject::~TransformFeedbackObject()
{
	GL( glDeleteTransformFeedbacks(1, &id); )
}

void TransformFeedbackObject::bindBufferBase(const U32 &buffer_id, const S32 &binding_point)
{
	if(binding_point >= 0)
		GL( glBindBufferBase(GL_TRANSFORM_FEEDBACK_BUFFER, binding_point, buffer_id);  )
	else
		GL( glBindBuffer(GL_TRANSFORM_FEEDBACK_BUFFER, buffer_id);  )
}

void TransformFeedbackObject::bind()
{
	GL( glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, id); )
}

void TransformFeedbackObject::begin(const U32 &type)
{
	GL( glBeginTransformFeedback(type); )
}

void TransformFeedbackObject::end()
{
	GL( glEndTransformFeedback(); )
}

void TransformFeedbackObject::pause()
{
	GL( glPauseTransformFeedback(); )
}

void TransformFeedbackObject::resume()
{
	GL( glResumeTransformFeedback(); )
}

void TransformFeedbackObject::unbind()
{
	glBindTransformFeedback(GL_TRANSFORM_FEEDBACK, 0);
}

void TransformFeedbackObject::draw(const U32 &type)
{
	glDrawTransformFeedback(type, id);
}
